package org.osomit.sacct.remoting.socket;

import org.osomit.sacct.io.iface.ServerReaderWriter;
import org.osomit.sacct.service.handler.iface.ServiceHandler;
import org.osomit.sacct.session.manager.iface.SessionManager;
import com.google.inject.Inject;
import com.google.inject.Provider;

/**
 * @author Jian Fang (John.Jian.Fang@gmail.com)
 *
 * Date: Jun 29, 2009
 */

public class SocketWorkerProvider implements Provider<SocketWorker> {
    
    private ServerReaderWriter serverReaderWriter;

    private ServiceHandler handler;

    private SessionManager sessionManager;

    public SessionManager getSessionManager() {
        return sessionManager;
    }

    @Inject
    public void setSessionManager(SessionManager sessionManager) {
        this.sessionManager = sessionManager;
    }

    public ServerReaderWriter getServerReaderWriter() {
        return serverReaderWriter;
    }

    @Inject
    public void setServerReaderWriter(ServerReaderWriter serverReaderWriter) {
        this.serverReaderWriter = serverReaderWriter;
    }

    public ServiceHandler getHandler() {
        return handler;
    }

    @Inject
    public void setHandler(ServiceHandler handler) {
        this.handler = handler;
    }

    public SocketWorker get() {
        SocketWorker worker = new SocketWorker();
        worker.setServerReaderWriter(this.serverReaderWriter);
        worker.setHandler(this.handler);
        worker.setSessionManager(this.sessionManager);
        
        return worker;
    }
}
